package com.bird.system.application.menu

import com.bird.component.security.common.util.userId
import com.bird.system.application.menu.pl.*
import com.bird.system.domain.menu.MenuHandler
import org.springframework.stereotype.Service
/**
 * 菜单命令服务
 */
@Service
class MenuCommandService(private val menuHandler: MenuHandler) {
    /**
     * 添加菜单
     */
    fun addMenu(addMenuRequest: AddMenuRequest) {
        //入参转菜单实体
        val menuEntity = addMenuRequest.toEntity()
        //调用菜单领域服务添加菜单
        menuHandler.addMenu(menuEntity)
    }

    /**
     * 更新菜单
     */
    fun updateMenu(updateMenuRequest: UpdateMenuRequest) {
        //调用菜单领域服务更新菜单
        menuHandler.updateMenu(updateMenuRequest.id, updateMenuRequest.toUpdateMenuVO())
    }

    /**
     * 删除菜单
     */
    fun deleteMenu(menuId: Long) {
        //调用菜单领域服务删除菜单
        menuHandler.deleteMenu(menuId)
    }


}